home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7725 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1008 b   |  39 lines

  1. Path: news.uminho.pt!newsadm
  2. From: Rui Bastos <rui@jupiter.di.uminho.pt>
  3. Newsgroups: comp.lang.c
  4. Subject: realloc(NULL,100)
  5. Date: Wed, 28 Feb 1996 14:54:40 +0000
  6. Organization: Universidade do Minho
  7. Message-ID: <31346CB0.41C67EA6@jupiter.di.uminho.pt>
  8. NNTP-Posting-Host: jupiter.di.uminho.pt
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (X11; I; SunOS 4.1.3 sun4c)
  13.  
  14. Hi,
  15.  
  16.    Does anybody knows what's the expected behaviour of this program?
  17.  
  18. #include <stdio.h>
  19. #include <malloc.h>
  20.  
  21. main()
  22. {
  23.    void *x=NULL;
  24.    x=realloc(NULL,100);
  25.    printf("%p\n",x);
  26. }
  27.  
  28.   I tested it under diferent compilers/operating systems
  29. and  it returns null, others returns a valid address and other
  30. crashes.
  31.  
  32. Regars,
  33.  
  34. PS please and send me an email if you reply to this post.
  35. -- 
  36. Rui Duarte Tavares Bastos   rui@jupiter.di.uminho.pt
  37. Home page :            http://jupiter.di.uminho.pt/~rui
  38. Sporting Home page :   http://jupiter.di.uminho.pt/~rui/futebol/sporting
  39.